import { ajaxService } from '@/utils/request';

const env = import.meta.env;
// let baseURL = env.VITE_API_BASE_URL;
let baseURL = env.VITE_INVENTORY_URL;
let appURL = env.VITE_INVENTORYx_URL;

// 新增销售出库
export function PostOutboundAll(data?: any) {
  return ajaxService({
    url: '/warehouse/outbound/post',
    method: 'post',
    baseURL,
    data,
  });
}

// 获取销售出库列表
export function getOutboundAll(params?: any) {
  return ajaxService({
    url: '/warehouse/outbound/getall',
    method: 'get',
    baseURL,
    params,
  });
}

// 获取销售出库单个详情
export function getOutboundDetails(params?: any) {
  return ajaxService({
    url: '/warehouse/outbound/get',
    method: 'get',
    baseURL,
    params,
  });
}

// 确认出库单
export function putOutboundConfirm(data?: any) {
  return ajaxService({
    url: '/warehouse/outbound/confirm',
    method: 'put',
    baseURL,
    data,
  });
}

export function getInvoiceOne(params?: any) {
  return ajaxService({
    url: '/warehouse/invoice/getOnePost',
    method: 'get',
    baseURL,
    params,
  });
}

export function postInvoice(data?: any) {
  return ajaxService({
    url: '/warehouse/invoice/post',
    method: 'post',
    baseURL,
    data,
  });
}

// 新增发货单(委外)
export function postOutsourcingInvoice(data?: any) {
  return ajaxService({
    url: '/warehouse/invoice/outsourcing/post',
    method: 'post',
    baseURL,
    data,
  });
}

// 新增发货单(委外)
export function putInspectionState(data?: any) {
  return ajaxService({
    url: '/wechat/warehouse/outbound/inspection/state',
    method: 'put',
    baseURL: appURL,
    data,
  });
}
